package model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import util.datebase.ConexionDB;
import entidad.Bien;
import entidad.Detalle_Area_Persona;

public class Detalle_Area_PersonaModel {
	
	public Detalle_Area_Persona buscadetalleAreaPersona(String idPersona){
		Detalle_Area_Persona bean = null;
		Connection conn = null;
		PreparedStatement pstm = null;
		try {
			conn = new ConexionDB().getConexion();
			String sql ="select * from detalle_area_persona where idPersona=?";
			pstm = conn.prepareStatement(sql);
			pstm.setString(1, idPersona);
			ResultSet rs = pstm.executeQuery();
			if(rs.next()){
				bean = new Detalle_Area_Persona();
				bean.setIdArea(rs.getString("idArea"));
				bean.setIdPersona(rs.getString("idPersona"));
				bean.setEsJefe(rs.getInt("esJefe"));
			}
		} catch (Exception e) {
			System.out.println(e);
		} finally{
			try {
				if (pstm != null)
					pstm.close();
				if (conn != null)
					conn.close();
			} catch (SQLException e) {
			}
		}
		return bean;
	}

}
